<!DOCTYPE html>
<html lang="en">
<head>
  <title>浩然金融中心管理平台</title>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0"
        name="viewport">
  <#include "/common/csslib.html">
  <script type="text/javascript">
      var apiFacadeObjTable;
  </script>
</head>
<body>
<div class="main-wrapper">
  <!-- start: MAIN CONTAINER -->
  <div class="main-container inner">
    <!-- start: PAGE -->
    <div class="main-content">
      <div class="container">
        <!-- 当前位置 begin -->
        <div class="row h-home-path">
          <div class="col-md-12">
            <ol class="breadcrumb">
              <li><i class="fa fa-home"></i>&nbsp;&nbsp;所在位置</li>
              <li>首页</li>
              <li class="active">接口方法参数对象</li>
            </ol>
          </div>
        </div>
        <!-- 当前位置 end -->

        <!-- 查询筛选内容 bagin -->
        <div class="row h-main-search">
          <form action="javascript:;" method="post">
            <div class="col-md-1 col-sm-1 col-xs-1 text-right">
              <label class="control-labe h-form-label" for="objCode">请求对象编码：</label>
            </div>
            <div class="col-md-2 col-sm-2 col-xs-2">
              <input class="form-control" id="objCode" name="objCode" type="text" value="">
            </div>
            <div class="col-md-1 col-sm-1 col-xs-1 text-right">
              <label class="control-labe h-form-label" for="objName">请求对象名称：</label>
            </div>
            <div class="col-md-2 col-sm-2 col-xs-2">
              <input class="form-control" id="objName" name="objName" type="text" value="">
            </div>
            <@PageDict dict_name="objType" dict_desc="参数对象类型" dict_key="std_zb_obj_type"
            dict_value="" dict_type="select" page_type="index"/>
            <div class="pull-right h-btn-group">
              <button class="btn btn-info" onclick="ApiFacadeObjManager.search()" type="button"><i class="fa fa-search">&nbsp;&nbsp;</i>查询
              </button>
              <@permission btnType="add" btnId="addBtn" btnValue="新增" op="api:facadeObj:add"
              btnMethod="ApiFacadeObjManager.addApiFacadeObj()"/>
              <div id="btnPermission" style="display:none">
                <div class="h-btn-group">
                  <@permission btnType="edit" btnLink="true" btnValue="修改" btnClass="btn btn-info" btnId="editBtn"
                  op="api:facadeObj:edit"/>
                  <@permission btnType="delete" btnLink="true" btnValue="删除" btnId="deleteBtn" btnClass="btn btn-danger"
                  op="api:facadeObj:del"/>
                  <@permission btnType="view" btnLink="true" btnValue="查看" btnId="viewBtn" btnClass="btn btn-warning"
                  op="api:facadeObj:view"/>
                </div>
              </div>
              <button class="btn btn-default" type="reset"><i class="fa fa-mail-reply">&nbsp;&nbsp;</i>重置</button>
            </div>
          </form>
        </div>

        <!-- 表格 begin -->
        <div class="panel panel-white h-panel">
          <div class="panel-body">
            <table class="table table-striped table-bordered table-hover text-center" id="apiFacadeObj_table"
                   style='width:100%'></table>
          </div>
        </div>
        <!-- 表格 end -->
      </div>
    </div>
    <!-- end: PAGE -->
  </div>
  <!-- end: MAIN CONTAINER -->
  <!-- 新增 end -->
  <!-- end: SUBVIEW SAMPLE CONTENTS -->
</div>
<#include "/common/jslib.html">

<script type="text/javascript">
    $(function () {
        ApiFacadeObjManager = {
            init: function () {

            },
            search: function () {
                var queryCond = {
                    objType: $("#objType").val()
                    , objName: $("#objName").val()
                    , objCode: $("#objCode").val()
                };
                apiFacadeObjTable.options.queryCond = queryCond;
                var tableId = apiFacadeObjTable.options.tableId;
                $(tableId).DataTable().draw();
            },
            addApiFacadeObj: function () {
                window.location.href = "/apiFacadeObj/to-form?operation=add";
            },
            handleOperate: function (operate, id) {
                if (operate == "delete") {
                    ApiFacadeObjManager.deleteApiFacadeObj(id);
                } else if (operate == "edit" || operate == "view") {
                    window.location.href = "/apiFacadeObj/to-tab?operation=" + operate +
                        "&id=" + id;
                }
            },
            deleteApiFacadeObj: function (id) {
                var url = "/apiFacadeObj/delete";
                var data = {
                    "id": id
                };
                Jmts.deleteItem("确认要删除吗？", url, data, function (result) {
                    if (result.success) {
                        Jmts.succTips("删除成功");
                      ApiFacadeObjManager.search();
                    }
                });
            }
        }
        ApiFacadeObjManager.init();
    });
</script>
<!-- 弹窗下拉 -->
<script type="text/javascript">
    (function () {
        // datatable插件
        apiFacadeObjTable = new mi.datatable({
            tableId: '#apiFacadeObj_table',
            headerList: [
                '参数对象编码',
                '参数对象名称',
                '参数对象类型',
                '参数对象包路径',
                '操作'
            ],
            headerName: [
                'objCode',
                'objName',
                'objTypeCn',
                'objPackage',
                'operate'
            ],
            ajaxUrl: '/apiFacadeObj/listApiFacadeObj',
            queryCond: function () {

            },
            createdRow: function (row, data, dataIndex) {
                $(row).children('td').eq(0).attr('style', 'text-align:left;');
                $(row).children('td').eq(1).attr('style', 'text-align:left;');
                $(row).children('td').eq(2).attr('style', 'text-align:left;');
                $(row).children('td').eq(3).attr('style', 'text-align:left;');
            },
            columnDefs: [],
            dataSrc: function (data) {
                for (var i in data) {
                    var id = data[i]['id'];
                    if ($("#editBtn") != null && $("#editBtn") != undefined) {
                        $("#editBtn").attr("href", "javascript:ApiFacadeObjManager.handleOperate('edit', '" + id + "')");
                    }
                    if ($("#deleteBtn") != null && $("#deleteBtn") != undefined) {
                        $("#deleteBtn").attr("href", "javascript:ApiFacadeObjManager.handleOperate('delete','" + id + "')");
                    }
                    if ($("#viewBtn") != null && $("#viewBtn") != undefined) {
                        $("#viewBtn").attr("href", "javascript:ApiFacadeObjManager.handleOperate('view','" + id + "')");
                    }
                    data[i]['operate'] = $("#btnPermission").html();
                }
                return data;
            }
        });
    })();
</script>
</body>
</html>
